<?php 
include_once 'admin-functions.php';
include_once '../functions.php';

if ((isset($_SESSION['logged_in'])) && ($_SESSION['account_rank'] == 0)) {}
else {header('Location: page.php');exit;}

if (isset($_POST['updated']) && isset($_SESSION['logged_in']) && $_SESSION['account_rank'] == 0) {
	$blog_title = addslashes(htmlspecialchars($_POST['blog_title']));
	$blog_author = addslashes(htmlspecialchars($_POST['blog_author']));
	$blog_url  = $_POST['blog_url'];
	$blog_heading_st_tag  = "<" . $_POST['tag'] . ">";	
	$blog_heading_end_tag  = "</" . $_POST['tag'] . ">";		
	
	$blog_controller = $_POST['blog_controller'];
	
	$blog_posts_per_page = $_POST['ppp'];	
	$the_array['config'] = $_POST;
	array_write($the_array, $blog_config);
}



include_once 'theme/top.php';
?><h2>Configure</h2>

<p></p>
			<form action="page.php?p=configure" method="post">								
						<label for="blog_controller"><strong>Controller File </strong><em>ie. blog.php</em></label>
						<p class="input">
							<input name="blog_controller" id="blog_controller" value="<?php echo $blog_controller;?>" />
						</p>
						
						<label for="header"><strong>Post Title Tags</strong></label>
						<p style="margin-top:-1em;">
						 <select style="width:130px;" name="tag" id="tag">
						 	<option <?php if ($blog_heading_st_tag=="<h1>") {echo "selected=\"yes\"";}?> value="h1">&nbsp;&lt;h1&gt;&lt;/h1&gt;</option>
						 	<option <?php if ($blog_heading_st_tag=="<h2>") {echo "selected=\"yes\"";}?> value="h2">&nbsp;&lt;h2&gt;&lt;/h2&gt;</option>
						 	<option <?php if ($blog_heading_st_tag=="<h3>") {echo "selected=\"yes\"";}?> value="h3">&nbsp;&lt;h3&gt;&lt;/h3&gt;</option>
						 </select>
						 </p>
						 
						<label for="ppp"><strong>Posts Per Page</strong></label>
						<p style="margin-top:-1em;">
						 <select style="width:50px;" name="ppp" id="ppp">
						 	<option <?php if ($blog_posts_per_page=="5") {echo "selected=\"yes\"";}?> value="5">&nbsp;5</option>
						 	<option <?php if ($blog_posts_per_page=="10") {echo "selected=\"yes\"";}?> value="10">&nbsp;10</option>
						 	<option <?php if ($blog_posts_per_page=="15") {echo "selected=\"yes\"";}?> value="15">&nbsp;15</option>
						 	<option <?php if ($blog_posts_per_page=="20") {echo "selected=\"yes\"";}?> value="20">&nbsp;20</option>						 	
						 	<option <?php if ($blog_posts_per_page=="25") {echo "selected=\"yes\"";}?> value="25">&nbsp;25</option>						 	
						 </select>
						 </p>

						<label for="blog_title"><strong>Blog Title: </strong></label>
						<p class="input">
							<input name="blog_title" id="item_a" value="<?php echo $blog_title;?>" />
						</p>
						
						<label for="blog_url"><strong>URL:</strong> <em>ie. http://mywebsite.com/</em></label>
						<p class="input">
							<input name="blog_url" id="item_a" value="<?php echo $blog_url;?>" />
						</p>	
						
						<label for="blog_author"><strong>Author: (For Atom Feed)</strong></label>
						<p class="input">
							<input name="blog_author" id="blog_author" value="<?php echo $blog_author;?>" />
						</p><p><br /></p>
						<input type="hidden" name="updated" value="yes" />
						
						
						
						
						<p class="button">
							<button name="submit" onclick="return confirmSubmit('Are you sure you want to update your settings?')" type="submit">Save!</button></p>
					</form>
<?php include_once 'theme/bottom.php';?>